﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Xml.Serialization;

namespace _1041326_1041339_1041433.UserPages
{
    public partial class BuySaleDetail : System.Web.UI.Page
    {
        String url = "http://localhost:1871/Service.svc";
        protected void Page_Load(object sender, EventArgs e)
        {
            HienThiTinTuc();
            HienThiBinhLuan();

        }
        private void HienThiBinhLuan()
        {
            String ma = Request["id"];
            var requestURL = url + "/comment/" + ma;
            WebRequest wr = WebRequest.Create(requestURL);
            WebResponse wp = wr.GetResponse();
            XmlSerializer serial = new XmlSerializer(typeof(ArrayOfBinhLuanDTO));
            ArrayOfBinhLuanDTO ds = (ArrayOfBinhLuanDTO)serial.Deserialize(wp.GetResponseStream());
            gvBinhLuan.DataSource = ds.Items;
            gvBinhLuan.DataBind();

        }
        private void HienThiTinTuc()
        {
            String ma = Request["id"];
            var requestURL = url + "/news/" + ma;
            WebRequest wr = WebRequest.Create(requestURL);
            WebResponse wp = wr.GetResponse();
            XmlSerializer serial = new XmlSerializer(typeof(ArrayOfTinTucDTO));
            ArrayOfTinTucDTO ds = (ArrayOfTinTucDTO)serial.Deserialize(wp.GetResponseStream());
            gvTinTuc.DataSource = ds.Items;
            gvTinTuc.DataBind();

        }
       
    }
}